package kvraft

const (
	OK              = "OK"
	ErrNoKey        = "ErrNoKey"
	ErrWrongLeader  = "ErrWrongLeader"
	ErrFailToCommit = "ErrFailToCommit"
)

type Err string

// Put or Append
type PutAppendArgs struct {
	Pattern int64
	Key     string
	Value   string
	Op      string // "Put" or "Append"
	// You'll have to add definitions here.
	// Field names must start with capital letters,
	// otherwise RPC will break.
}

type PutAppendReply struct {
	Err Err
}

type GetArgs struct {
	Key string
	// You'll have to add definitions here.
}

type GetReply struct {
	Err   Err
	Value string
}

type ConfirmArgs struct {
	Pattern int64
}
type ConfirmReply struct {
	Err Err
}

func (rpl *GetReply) GetErr() Err {
	return rpl.Err
}
func (rpl *PutAppendReply) GetErr() Err {
	return rpl.Err
}
func (rpl *ConfirmReply) GetErr() Err {
	return rpl.Err
}

/*
func (rpl *GetReply) CreateDefault() interface{} {
	return GetReply{}
}
func (rpl *PutAppendReply) CreateDpefault() interface{} {
	return PutAppendReply{}
}
func (rpl *ConfirmReply) CreateDefault() interface{} {
	return ConfirmReply{}
}
*/
type BaseReply interface {
	GetErr() Err
}
